	//传入的新密码
	var newPassword = "";
	//传入的确认密码
	var verifyPassword = "";
	var regExp = /^[a-zA-Z0-9_]{6,16}$/;
	
	/**防止某一个条件符合要求就可以提交密码;*/
	//验证原始密码
	var flagA = false;
	//验证新密码
	var flagB = false;
	//验证确认密码
	var flagC = false;
	
	function checkOldPwd() {
		var oldPassword = $("input[name='oldPassword']").val();
		$.ajax({
			type : "GET",
			url : contextPath+"/user/verifyPassword",
			data : {"oldPassword":oldPassword},
			traditional : true, 
			cache : false,
			timeout : 600000,
			success : function(data) {
				if(data=="success") {
					$("#content").html("");
					$("#remove").css("display","none");
					$("#check").css("display","block");
					flagA = true;
				} else {
					$("#content").html(data);
					$("#content").css({"color":"red"});
					$("#check").css("display","none");
					$("#remove").css("display","block");
					flagA = false;
				}
			},
			error : function(jqXHR, textStatus, errorThrown) {
				alert("error");
				alert(jqXHR.responseText);
			}
		});
	}
	
	function checkNewPwd() {
		newPassword = $("input[name='newPassword']").val();
		if(regExp.test(newPassword)) {
			$("#content").html("");
			$("#remove1").css("display","none");
			$("#check1").css("display","block");
			flagB = true;
		} else {
			$("#content").html("密码由字母数字和下划线组成，长度在6-16之间！");
			$("#content").css({"color":"red"});
			$("#check1").css("display","none");
			$("#remove1").css("display","block");
			flagB = false;
		}
	}
	
	function checkVerifyPwd() {
		verifyPassword = $("input[name='verifyPassword']").val();
		if(!regExp.test(verifyPassword)) {
			$("#content").html("密码由字母数字和下划线组成，长度在6-16之间！");
			$("#content").css({"color":"red"});
			$("#check2").css("display","none");
			$("#remove2").css("display","block");
			flagC = false;
		} else if(newPassword!=verifyPassword) {
			$("#content").html("密码不一致！");
			$("#content").css({"color":"red"});
			$("#check2").css("display","none");
			$("#remove2").css("display","block");
			flagC = false;
		} else {
			$("#content").html("");
			$("#remove2").css("display","none");
			$("#check2").css("display","block");
			flagC = true;
		}
	}
	
	function modifyPwd() {
      if(flagA && flagB && flagC) {
        $("form").submit();  
      }
	}